<?php

class Form_Field_Textarea_Exception extends Form_Field_Exception {}
class Form_Field_Textarea_Incomplete_Exception extends Form_Field_Textarea_Exception {}

class Form_Field_Textarea extends Form_Field {

	protected $value;

	public function value($value){
		$this->value = $value;
	}

	public function output($base, $main = null){
		$tpl = Output::getInstance()->Template(array('form','field','textarea'));
		$tpl->title = $this->title;
		$tpl->value = $this->value;
		$base[] = $this->name;
		$tpl->name = $base;
		return parent::output($base, $tpl);
	}

	public function run($value){
		if(!isset($value)){
			throw new Form_Field_Textarea_Incomplete_Exception();
		}
		$this->value = $value;
	}

	public function data(){
		return $this->value;
	}

}
